<template>
  <div class="not-found">
    <h1>404</h1>
    <div class="timeout">
      <span>页面未找到</span>
      <span>{{ timeout }}</span>
      <span>秒后自动跳转</span>
      <span>...</span>
      <router-link to="/">回到首页</router-link>
      <span>...</span>
      <router-link to="/about">回到关于</router-link>
    </div>
  </div>
</template>

<script setup lang="ts">
const event: any = useRequestEvent();
setResponseStatus(event, 404, "页面未找到");

const timeout = ref(5);
const timer = setInterval(() => {
  timeout.value--;
  if (timeout.value <= 0) {
    clearTimeout(timer);
  }
}, 1000);
</script>
